#version 430
#include "eustis_builtin_uniforms"
in vec3 pos;
out vec3 pos_near;
out vec3 pos_far;

void main() {
  gl_Position = vec4(pos, 1);

  vec2 pos_ndc = gl_Position.xy / gl_Position.w;
  mat4 inv_mat = _view_mat_inv * _proj_mat_inv;
  vec4 pos_near4 = inv_mat * vec4(pos_ndc, -1.0, 1.0);
  vec4 pos_far4 = inv_mat * vec4(pos_ndc, 1.0, 1.0);

  pos_near = pos_near4.xyz / pos_near4.w;
  pos_far = pos_far4.xyz / pos_far4.w;
}
